package com.rural.bus.driver;

import java.util.ArrayList;
import java.util.List;

import android.app.Application;
import cn.jpush.android.api.JPushInterface;

import com.baidu.mapapi.SDKInitializer;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.rural.bus.driver.config.MyPreferenceManager;
import com.rural.bus.driver.config.PreferenceKey;
import com.rural.bus.driver.model.DriverInfo;
import com.rural.bus.driver.model.Order;
import com.rural.bus.driver.utils.CommonTools;

public class MyApplication extends Application {
	private static MyApplication instance;
	
	public double curLongtitude;
	public double curLatitude;
	public static String userId = "";
	public static DriverInfo driverInfo;
	public static int driverStatus;
		
	public static MyApplication instance() {
		return instance;
	}
	
	@Override
	public void onCreate() {
		super.onCreate();
		instance = this;
		
		String strDriverInfo = MyPreferenceManager.instance().getSharedInfoByKey(PreferenceKey.USER_INFO, "");
		if(driverInfo == null && !CommonTools.isEmpty(strDriverInfo)){
			driverInfo = new Gson().fromJson(strDriverInfo, new TypeToken<DriverInfo>() {  
            }.getType());
		}
		
		JPushInterface.setDebugMode(true);
		JPushInterface.init(this);
		SDKInitializer.initialize(this);	
		
	}


}
